﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="uc_NhapChiPhi_View.ascx.cs"
    Inherits="Cost_UserControl_uc_NhapChiPhi_View" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<style type="text/css" media="print">
    .jwts_tabbernav
    {
        display: none;
    }
</style>
<script type="text/javascript">    var jwts_slideSpeed = 30; var jwts_timer = 10;</script>
<script type="text/javascript">
    function OnKeyDuongBien() {
        var grid = document.getElementById("<%= gridDuongBien.ClientID %>");
        var row;
        var cell;

        var Total = 0;
        if (grid.rows.length > 0) {
            for (i = 1; i < grid.rows.length; i++) {
                var row = grid.rows[i];
                var ischeck = false;
                for (k = 0; k < row.cells[0].childNodes.length; k++) {
                    if (row.cells[0].childNodes[k].type == "checkbox") {
                        if (row.cells[0].childNodes[k].checked == true) {

                            ischeck = true;
                        }
                    }
                }
                if (ischeck) {
                    for (j = 0; j < row.cells[2].childNodes.length; j++) {
                        if (row.cells[2].childNodes[j].type == "text") {
                            if ((replaceAll(row.cells[2].childNodes[j].value, ',', '').value != 'NaN') && (replaceAll(row.cells[2].childNodes[j].value, ',', '').length > 0)) {
                                try {
                                    Total += parseInt(replaceAll(row.cells[2].childNodes[j].value, ',', ''));
                                } catch (e) {

                                }
                                Total += 0;
                            }
                        }
                    }
                }
            }
        }
        document.getElementById("<%= lblTongCongDuongBien.ClientID %>").innerHTML = addCommasString(Total);

    }

    function OnKeyDuongKhong() {
        var grid = document.getElementById("<%= gridDuongKhong.ClientID %>");
        var row;
        var cell;

        var Total = 0;
        if (grid.rows.length > 0) {
            for (i = 1; i < grid.rows.length; i++) {
                var row = grid.rows[i];
                var ischeck = false;
                for (k = 0; k < row.cells[0].childNodes.length; k++) {
                    if (row.cells[0].childNodes[k].type == "checkbox") {
                        if (row.cells[0].childNodes[k].checked == true) {

                            ischeck = true;
                        }
                    }
                }
                if (ischeck) {
                    for (j = 0; j < row.cells[2].childNodes.length; j++) {
                        if (row.cells[2].childNodes[j].type == "text") {
                            if ((replaceAll(row.cells[2].childNodes[j].value, ',', '').value != 'NaN') && (replaceAll(row.cells[2].childNodes[j].value, ',', '').length > 0)) {
                                try {
                                    Total += parseInt(replaceAll(row.cells[2].childNodes[j].value, ',', ''));
                                } catch (e) {

                                }
                                Total += 0;
                            }
                        }
                    }
                }
            }
        }
        document.getElementById("<%= lblTongCongDuongKhong.ClientID %>").innerHTML = addCommasString(Total);

    }
    function OnKeyDuongBo() {
        var grid = document.getElementById("<%= gridDuongKhac.ClientID %>");
        var row;
        var cell;

        var Total = 0;
        if (grid.rows.length > 0) {
            for (i = 1; i < grid.rows.length; i++) {
                var row = grid.rows[i];
                var ischeck = false;
                for (k = 0; k < row.cells[0].childNodes.length; k++) {
                    if (row.cells[0].childNodes[k].type == "checkbox") {
                        if (row.cells[0].childNodes[k].checked == true) {

                            ischeck = true;
                        }
                    }
                }
                if (ischeck) {
                    for (j = 0; j < row.cells[2].childNodes.length; j++) {
                        if (row.cells[2].childNodes[j].type == "text") {
                            if ((replaceAll(row.cells[2].childNodes[j].value, ',', '').value != 'NaN') && (replaceAll(row.cells[2].childNodes[j].value, ',', '').length > 0)) {
                                try {
                                    Total += parseInt(replaceAll(row.cells[2].childNodes[j].value, ',', ''));
                                } catch (e) {

                                }
                                Total += 0;
                            }
                        }
                    }
                }
            }
        }
        document.getElementById("<%= lblTongCongDuongBo.ClientID %>").innerHTML = addCommasString(Total);

    }
</script>
<div style="min-height: 800px; height: 100%">
    <div class="TitlePage">
        CẬP NHẬT
        NHẬP CHI PHÍ</div>
    <asp:Panel runat="server" ID="Panel1">
        <div style="text-align: left; width: 100%">
            <fieldset>
                <table width="100%">
                    <tr>
                        <td class="tdsearch1">
                        </td>
                        <td align="left" class="tdsearch2">
                            Số vận đơn <span style="color: Red">(*)</span>:
                        </td>
                        <td align="left" class="tdsearch3">
                            <asp:TextBox runat="server" ID="txtSoVanDon" MaxLength="50" CssClass="txtBox" Width="100%"
                                ReadOnly="true"></asp:TextBox>
                        </td>
                        <td class="tdsearch4">
                        </td>
                        <td align="left" class="tdsearch5">
                            Số tờ khai:
                        </td>
                        <td align="left" class="tdsearch6" style="margin-right: 5px">
                            <asp:TextBox runat="server" ID="txtSoToKhai" MaxLength="50" CssClass="txtBox" Width="100%"></asp:TextBox>
                        </td>
                        <td class="tdsearch7">
                        </td>
                    </tr>
                    <tr>
                        <td align="center" colspan="7">
                            <asp:Label ID="lblAlerting" runat="server" CssClass="Alerting"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td align="center" colspan="7">
                            &nbsp;<asp:Button CssClass="btn_admin" ID="btnAdd" runat="server" Text="Cập nhật"
                                OnClick="btnSave_Click" />
                        </td>
                    </tr>
                </table>
            </fieldset>
        </div>
    </asp:Panel>
    <div style="clear: both; height: 10px">
    </div>
    <div>
        <div id="divSearchList1">
            <div class="box_tin">
                <div class="box_tin_title">
                    Đường biển</div>
                <asp:GridView ID="gridDuongBien" runat="server" AllowPaging="True" AutoGenerateColumns="false"
                    CssClass="grid1" Width="100%" PageSize="50">
                    <Columns>
                        <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20px">
                            <ItemTemplate>
                                <asp:CheckBox ID="chkSave" runat="server" Checked='<%# Eval("ISCHECK") %>' onClick="OnKeyDuongBien();" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="CHIPHID" ItemStyle-Width="10px" Visible="false">
                            <ItemTemplate>
                                <asp:Label ID="lblListingCHIPHID" runat="server" Text='<%# Eval("CHIPHIID") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Nhóm" ItemStyle-Width="10px" ItemStyle-HorizontalAlign="LEFT"
                            Visible="false">
                            <ItemTemplate>
                                <asp:Label ID="lblListingNhom" runat="server" Text='<%# Eval("TenNhom") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Tên chi phí" ItemStyle-HorizontalAlign="LEFT">
                            <ItemTemplate>
                                <asp:Label ID="lblListingTenChiPhi" runat="server" Text='<%# Eval("TENCHIPHI") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Số tiền" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px">
                            <ItemTemplate>
                                <asp:TextBox ID="txtSoTien" onmousedown="clrTextBox(this);" onKeyUp="addCommas(event,this);OnKeyDuongBien();"
                                    runat="server" Text='<%# string.Format("{0:N0}",Eval("SOTIEN")) %>' CssClass="txtnumber"
                                    Width="98%"></asp:TextBox>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <PagerStyle CssClass="pager" HorizontalAlign="Right" />
                </asp:GridView>
                <table class="grid1" cellspacing="0" border="1" style="width: 100%; border-collapse: collapse;"
                    rules="all">
                    <tbody>
                        <tr>
                            <td align="right" colspan="2">
                                <span>Tổng cộng:</span>
                            </td>
                            <td align="center" style="width: 100px;">
                                <div style="text-align: right;">
                                    <div style="width: 100px; float: right">
                                        <b>
                                            <asp:Label ID="lblTongCongDuongBien" runat="server">0</asp:Label></b></div>
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <!--Duong khong-->
            <div class="box_tin">
                <div class="box_tin_title">
                    Đường không</div>
                <asp:GridView ID="gridDuongKhong" runat="server" AllowPaging="True" AutoGenerateColumns="false"
                    CssClass="grid1" Width="100%" PageSize="50">
                    <Columns>
                        <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20px">
                            <ItemTemplate>
                                <asp:CheckBox ID="chkSave" runat="server" Checked='<%# Eval("ISCHECK") %>' onClick="OnKeyDuongKhong();" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="CHIPHID" ItemStyle-Width="10px" Visible="false">
                            <ItemTemplate>
                                <asp:Label ID="lblListingCHIPHID" runat="server" Text='<%# Eval("CHIPHIID") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Nhóm" ItemStyle-Width="10px" ItemStyle-HorizontalAlign="LEFT"
                            Visible="false">
                            <ItemTemplate>
                                <asp:Label ID="lblListingNhom" runat="server" Text='<%# Eval("TenNhom") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Tên chi phí" ItemStyle-HorizontalAlign="LEFT">
                            <ItemTemplate>
                                <asp:Label ID="lblListingTenChiPhi" runat="server" Text='<%# Eval("TENCHIPHI") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Số tiền" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px">
                            <ItemTemplate>
                                <asp:TextBox ID="txtSoTien" onmousedown="clrTextBox(this);" onKeyUp="addCommas(event,this);OnKeyDuongKhong();"
                                    runat="server" Text='<%# string.Format("{0:N0}",Eval("SOTIEN")) %>' CssClass="txtnumber"
                                    Width="98%"></asp:TextBox>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <PagerStyle CssClass="pager" HorizontalAlign="Right" />
                </asp:GridView>
                <table class="grid1" cellspacing="0" border="1" style="width: 100%; border-collapse: collapse;"
                    rules="all">
                    <tbody>
                        <tr>
                            <td align="right" colspan="2">
                                <span>Tổng cộng:</span>
                            </td>
                            <td align="center" style="width: 100px;">
                                <div style="text-align: right;">
                                    <div style="width: 100px; float: right">
                                        <b>
                                            <asp:Label ID="lblTongCongDuongKhong" runat="server">0</asp:Label></b></div>
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <!--khac-->
            <div class="box_tin">
                <div class="box_tin_title">
                    Đường bộ</div>
                <asp:GridView ID="gridDuongKhac" runat="server" AllowPaging="True" AutoGenerateColumns="false"
                    CssClass="grid1" Width="100%" PageSize="50">
                    <Columns>
                        <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20px">
                            <ItemTemplate>
                                <asp:CheckBox ID="chkSave" runat="server" Checked='<%# Eval("ISCHECK") %>' onClick="OnKeyDuongBo();" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="CHIPHID" ItemStyle-Width="10px" Visible="false">
                            <ItemTemplate>
                                <asp:Label ID="lblListingCHIPHID" runat="server" Text='<%# Eval("CHIPHIID") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Nhóm" ItemStyle-Width="10px" ItemStyle-HorizontalAlign="LEFT"
                            Visible="false">
                            <ItemTemplate>
                                <asp:Label ID="lblListingNhom" runat="server" Text='<%# Eval("TenNhom") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Tên chi phí" ItemStyle-HorizontalAlign="LEFT">
                            <ItemTemplate>
                                <asp:Label ID="lblListingTenChiPhi" runat="server" Text='<%# Eval("TENCHIPHI") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Số tiền" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px">
                            <ItemTemplate>
                                <asp:TextBox ID="txtSoTien" onmousedown="clrTextBox(this);" onKeyUp="addCommas(event,this);OnKeyDuongBo();"
                                    runat="server" Text='<%# string.Format("{0:N0}",Eval("SOTIEN")) %>' CssClass="txtnumber"
                                    Width="98%"></asp:TextBox>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <PagerStyle CssClass="pager" HorizontalAlign="Right" />
                </asp:GridView>
                <table class="grid1" cellspacing="0" border="1" style="width: 100%; border-collapse: collapse;"
                    rules="all">
                    <tbody>
                        <tr>
                            <td align="right" colspan="2">
                                <span>Tổng cộng:</span>
                            </td>
                            <td align="center" style="width: 100px;">
                                <div style="text-align: right;">
                                    <div style="width: 100px; float: right">
                                        <b>
                                            <asp:Label ID="lblTongCongDuongBo" runat="server">0</asp:Label></b></div>
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<asp:HiddenField ID="hdfID" runat="server" />
